package com.scuec.tourismwebsite.service;///接口实现
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.scuec.tourismwebsite.entity.WeatherRealTime;
import com.scuec.tourismwebsite.mapper.WeatherRealTimeMapper;
import com.scuec.tourismwebsite.vo.ViewWeatherRealTimeWithCity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
//实时
@Service
public class WeatherRealTimeServiceImpl implements WeatherRealTimeService {
    @Autowired
    private WeatherRealTimeMapper weatherRealTimeMapper;

    public WeatherRealTimeServiceImpl(WeatherRealTimeMapper weatherRealTimeMapper){
        this.weatherRealTimeMapper = weatherRealTimeMapper;
    }

    @Override
    public List<ViewWeatherRealTimeWithCity> getWeatherRealTime() {
        return weatherRealTimeMapper.getWeatherRealTime();
    }



    @Override
    public PageInfo<ViewWeatherRealTimeWithCity> findWeatherRealTimePages(Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<ViewWeatherRealTimeWithCity> lists = weatherRealTimeMapper.getWeatherRealTime();
        PageInfo<ViewWeatherRealTimeWithCity> pageInfo = new PageInfo<>(lists);
        return pageInfo;
    }

    @Override
    public Integer insertWeatherRealTime(WeatherRealTime weatherRealTime) {
        return weatherRealTimeMapper.insertWeatherRealTime(weatherRealTime);
    }

    @Override
    public Integer updateWeatherRealTime(WeatherRealTime weatherRealTime) {
        return weatherRealTimeMapper.updateWeatherRealTime(weatherRealTime);
    }

    @Override
    public Integer deleteWeatherRealTime(Integer weather_id) {
        return weatherRealTimeMapper.deleteWeatherRealTime(weather_id);
    }
}
